import { h } from 'vue';
import { NTag } from 'naive-ui';
import { NImage } from 'naive-ui';
import { BasicColumn } from '@/components/Table';

export const columns: BasicColumn[] = [
  {
    title: '序号',
    key: 'id',
    align: "center",
  }, {
    title: '用户名称',
    key: 'nickname',
    align: "center",
  }, {
    title: '属性',
    key: 'attr',
    align: "center",
    width: "150",
    render(row) {
      if (row.attr == 1) {
        return h(
          NTag,
          {
            type: 'info',
          },
          {
            default: () => ('分润问题'),
          },
        );
      } else if (row.attr == 2) {
        return h(
          NTag,
          {
            type: 'success',
          },
          {
            default: () => ('设备问题'),
          },
        );
      } else if (row.attr == 3) {
        return h(
          NTag,
          {
            type: 'warning',
          },
          {
            default: () => ('修改手机号问题'),
          },
        );
      }
    }
  }, {
    title: '标题',
    key: 'title',
    align: "center",
  }, {
    title: '描述',
    key: 'description',
    align: "center",
  }, {
    title: '单号',
    key: 'danhao',
    align: "center",
  }, {
    title: '设备SN',
    key: 'shebei_sn',
    align: "center",
  }, {
    title: '图片',
    key: 'image',
    align: "center",
    render(row) {
      return h(
        NImage,
        {
          width: 50,
          height: 50,
          src: row.image
        },
      );
    },
  }, {
    title: '创建时间',
    key: 'create_time',
    align: "center",
  }, {
    title: '处理状态',
    key: 'status',
    align: "center",
    render(row) {
      if (row.status == 1) {
        return h(
          NTag,
          {
            type: 'error',
          },
          {
            default: () => ('未处理'),
          },
        );
      } else if (row.status == 2) {
        return h(
          NTag,
          {
            type: 'success',
          },
          {
            default: () => ('已处理'),
          },
        );
      }
    }
  }, {
    title: '回复内容',
    key: 'hfcontent',
    align: "center",
  }, {
    title: '回复时间',
    key: 'hf_time',
    align: "center",
  }
];
